const path = require("path");
//./node_modules/.bin/webpack --config webpack.config.js
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');

module.exports = {
    //entry: "./src/index.js",
    entry:{
            app: './src/index.js',
            print: './src/print.js'
    },
     devtool: 'inline-source-map',
   devServer: {
     contentBase: './dist'
   },
     plugins:[
         new CleanWebpackPlugin(['dist']),
         new HtmlWebpackPlugin({
             title: 'Output Management'
         })
    ],

    output:{
        filename: '[name].bundle.js',
        path: path.resolve(__dirname,'dist')
    },

    module:{
        rules:[
            {
                test:/\.css$/,
                use:[
                    'style-loader',
                    'css-loader'
                ]
            },
            {
              //test: /\.[png|svg|jpg|gif]$/,
              test:/\.(png|svg|jpg|gif)$/,
              use:[
                  'file-loader'
              ]  
            }
        ]
    },
};
